#include <iostream>
#include <assert.h>
using namespace std;

class string
{
	string& operator=(const string& s)
	{
		delete[] _str;
		_str = new char[s._capacity + 1];
		strcpy(_str, s._str);
		_size = s._size;
		_capacity = s._capacity;
		return *this;
	}

	string& insert(size_t pos, const char* s)
	{
		assert(pos <= _size);
		size_t len = strlen(s);
		size_t end = len + _size;
		if (_capacity < end)
		{
			reserve(len + _size);
			_capacity = len + _size;
		}
		while (end > pos + len - 1)
		{
			_str[end] = _str[end - len];
			--end;
		}
		strncpy(_str + pos, s, len);
		_size += len;
		return *this;
	}
private:
	char* _str;
	int _size;
	int _capacity;
};




int main()
{
	

	return 0;
}